<template>
    <el-card shadow="never" style="max-height: 700px; overflow: auto">
        <el-form ref="form" :model="form" :rules="rules" label-width="90px" :disabled="disabled">
            <el-form-item label="id:" prop="id" v-show="false">
                <el-input v-model="form.id" disabled />
            </el-form-item>
            <!-- <el-form-item label="订单号:" prop="order_id">
                <el-input v-model="form.order_id" placeholder="请输入order_id" clearable />
            </el-form-item> -->
            <!-- <el-form-item label="fulfillment_type:" prop="fulfillment_type">
                <el-input v-model="form.fulfillment_type" placeholder="请输入fulfillment_type" clearable />
            </el-form-item> -->
            <!-- <el-form-item label="支付时间:" prop="paid_time">
                <el-date-picker v-model="form.paid_time" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择paid_time" />
            </el-form-item>         -->

            <!-- <el-form-item label="运输渠道:" prop="shipping_provider">
                <el-input v-model="form.shipping_provider" placeholder="请输入shipping_provider" clearable />
            </el-form-item> -->
            <!-- <el-form-item label="shipping_provider_id:" prop="shipping_provider_id">
                <el-input v-model="form.shipping_provider_id" placeholder="请输入shipping_provider_id" clearable />
            </el-form-item> -->
            <!-- <el-form-item label="运输类型:" prop="shipping_type">
                <el-input v-model="form.shipping_type" placeholder="请输入shipping_type" clearable />
            </el-form-item> -->
            <!-- <el-form-item label="status:" prop="status">
                <el-input v-model="form.status" placeholder="请输入status" clearable />
            </el-form-item> -->
            <el-form-item label="达人姓名:" prop="name">
                <el-input v-model="form.name" placeholder="" clearable />
            </el-form-item>
            <el-form-item label="链接:" prop="link">
                <el-input v-model="form.link" placeholder="" clearable />
            </el-form-item>
            <el-form-item label="发货SKU:" prop="skuinfo">
                <el-input v-model="form.skuinfo" placeholder="" clearable />
            </el-form-item>
            <el-form-item label="邮箱:" prop="buyer_email">
                <el-input v-model="form.buyer_email" placeholder="" clearable />
            </el-form-item>
            <el-form-item label="电话:" prop="phone_number">
                <el-input v-model="form.phone_number" placeholder="" clearable />
            </el-form-item>
            <el-form-item label="详细地址:" prop="address_detail">
                <el-input v-model="form.address_detail" placeholder="" clearable />
            </el-form-item>
            <el-form-item label="邮编:" prop="postal_code">
                <el-input v-model="form.postal_code" placeholder="" clearable />
            </el-form-item>
            <el-form-item label="省份:" prop="state">
                <el-input v-model="form.state" placeholder="" clearable />
            </el-form-item>
            <el-form-item label="市区:" prop="city">
                <el-input v-model="form.city" placeholder="" clearable />
            </el-form-item>
            <el-form-item label="县:" prop="county">
                <el-input v-model="form.county" placeholder="" clearable />
            </el-form-item>
            <el-form-item label="备注:" prop="remarks">
                <el-input v-model="form.remarks" placeholder="" clearable />
            </el-form-item>
            <el-form-item label="邮编:" prop="postal_code">
                <el-input v-model="form.postal_code" placeholder="" clearable />
            </el-form-item>

            <el-form-item>
                <el-button type="primary" @click="submitForm">确认 </el-button>
                <el-button type="warning" @click="cancel">取消 </el-button>
            </el-form-item>
        </el-form>
    </el-card>
</template>

<script>
export default {
name: 'EditForm',
props: {
    findFormData: {
        type: Object,
        default: {}
    },
    editFormParams: {
        type: Object,
        default: {}
    },
    // 表单是否禁用
    disabled: {
        type: Boolean,
        default: false,
    },
    
},
data() {
    return {
        // 编辑表单验证规则
        rules: {
    
        },
        form: {  },
      

    }
},
watch: {
    findFormData: {
       handler(nval) {
            if (JSON.stringify(nval) != '{}') {
                this.$nextTick(() => {
                    this.form = nval
                })
            }
        },
        immediate: true,
        deep: false,
    },
    
},
methods: {
    // 取消按钮
    cancel() {
        this.$emit('editFormCancel')
    },

    submitForm() {
        this.$refs['form'].validate((valid, obj) => {
            if (valid) {
                this.$emit('submitForm', this.form)
            }
        })
    },

    // 表单重置
    reset() {
        this.resetForm('form')
    }
}
}
</script>
